package com.zimin.cloud.system.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zimin.cloud.mine.pojo.file.business.FaceBO;
import com.zimin.cloud.mine.pojo.system.business.AccountBO;
import com.zimin.cloud.system.biz.IAccountBiz;
import com.zimin.cloud.system.controller.api.IAccountController;
import com.zimin.cloud.system.pojo.entity.Account;
import com.zimin.shared.pojo.BaseController;
import com.zimin.shared.pojo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 用户信息 前端控制器
 * </p>
 *
 * @author zimin
 * @since 2021-12-30 11:04
 */
@RestController
public class AccountController extends BaseController implements IAccountController {

    @Autowired
    private IAccountBiz accountBiz;

    @Override
    public Result accountPageList(Page<Account> accountPage, AccountBO accountBO) {
        return result(accountBiz.pageAccountList(accountPage, accountBO));
    }

    @Override
    public Result save(AccountBO accountBO) {
        return result(accountBiz.save(accountBO));
    }

    @Override
    public Result update(AccountBO accountBO) {
        return result(accountBiz.updateById(accountBO));
    }

    @Override
    public Result delete(List<String> idList) {
        return result(accountBiz.removeByIds(idList));
    }

    @Override
    public Result accountIsExist(String username) {
        return result(accountBiz.getAccountById(10000));
    }

    @Override
    public Result resetPassword(AccountBO accountBO) {
        return result(accountBiz.resetPassword(accountBO));
    }

    @Override
    public Result updatePassword(AccountBO accountBO) {
        return result(accountBiz.updatePassword(accountBO));
    }

    @Override
    public Result setFaceId(FaceBO faceBO) throws Exception {
        return result(accountBiz.setFaceId(faceBO));
    }

}
